package collection;

import java.util.ArrayList;
import java.util.function.Consumer;

public class CollectionDemo4 {
    public static void main(String[] args) {
        User u1 = new User("jack", 22);
        User u2 = new User("tom", 21);
        ArrayList<User> list = new ArrayList<>();
        list.add(u1);
        list.add(u2);
      /*  list.forEach(new Consumer<User>() {
            @Override
            public void accept(User user) {
                System.out.println(user);
            }
        });*/
        list.forEach(s -> System.out.println(s));


    }
}
